package cn.jhg.account.util;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import cn.jhg.account.entity.User;
//list集合去重复
public class ListUtil {
	public static List<User> removeDuplicateWithOrder(List<User> list) {  
	     	Set<User> set = new HashSet<User>();  
	        List<User> newList = new ArrayList<User>();  
	        for (Iterator<User> iter = list.iterator(); iter.hasNext();) {  
	        	User element = iter.next();  
	          if (set.add(element))  
	             newList.add(element);  
	       }   
	      list.clear();  
	      list.addAll(newList);  
	      return list;
	}  
}
